package com.xinxin.blockchain.asset.enums;

import com.xinxin.base.exception.BusinessException;
import com.xinxin.blockchain.constant.ErrorCode;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author ys
 * @date 2021/5/24
 */
@Getter
@AllArgsConstructor
public enum AssetTypeEnum {

    ZYZ(-1, "CS资产Z"),
    ;

    private Integer type;
    private String desc;

    public static AssetTypeEnum getByType(Integer type) {
        for (AssetTypeEnum value : AssetTypeEnum.values()) {
            if (value.type.equals(type)) {
                return value;
            }
        }

        throw new BusinessException(ErrorCode.ASSET_TYPE_NOT_EXIST);
    }
}
